package mju.cxf.handler;



import mju.cxf.exception.FileUploadException;

import mju.cxf.exception.PhotoException;
import mju.cxf.result.Result;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.multipart.MultipartException;

//管理员异常处理器
@RestControllerAdvice
@Order(0)
public class AdminExceptionHandler {
    @ExceptionHandler(FileUploadException.class)
    public Result<String> FileUploadHandler(FileUploadException ex){
        return Result.error(ex.getMessage());
    }
    @ExceptionHandler(MultipartException.class)
    public Result<String> MultipartHandler(MultipartException ex){
        return Result.error(ex.getMessage());
    }
    @ExceptionHandler(PhotoException.class)
    public Result<String> PhotoException(PhotoException ex){
        return Result.error(ex.getMessage());
    }

}
